package com.xuelang.pipeline.client.pipeline;

import com.xuelang.pipeline.client.common.request.PageParam;
import com.xuelang.pipeline.client.common.result.ApiResult;
import com.xuelang.pipeline.client.common.result.PageRecord;
import com.xuelang.pipeline.client.pipeline.dto.PipelineTagQuery;
import com.xuelang.pipeline.client.pipeline.dto.TagDTO;
import com.xuelang.pipeline.client.pipeline.dto.TagQuery;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;
import java.util.List;

/**
 * 流水线标签服务API
 *
 * @author xiwen.zxg
 * @since 2024/5/15
 */
public interface ITagService {

    /**
     * 查询流水线标签列表(有过滤条件，可以分页)
     *
     * @param dtoPageParam
     * @return
     */
    @PostMapping(value = "/pageList", produces = "application/json;charset=utf-8")
    ApiResult<PageRecord<TagDTO>> pageTagList(@RequestBody @Valid PageParam<TagQuery> dtoPageParam);

    /**
     * 查询流水线标签列表(有过滤条件)
     *
     * @param tagQuery
     * @return
     */
    @PostMapping(value = "/list", produces = "application/json;charset=utf-8")
    ApiResult<List<TagDTO>> conditionalTagList(@RequestBody @Valid TagQuery tagQuery);
    /**
     * 新增流水线标签
     *
     * @param tagDTO
     * @return
     */
    @PostMapping(value = "", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> addTag(@RequestBody @Valid TagDTO tagDTO);

    /**
     * 更新流水线标签
     *
     * @param tagDTO
     * @return
     */
    @PutMapping(value = "", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> updateTag(@RequestBody @Valid TagDTO tagDTO);

    /**
     * 批量新增/更新流水线标签
     * @param tagDTOList
     * @return
     */
    @PostMapping(value = "/batchSaveOrUpdate", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> batchSaveOrUpdate(@RequestBody List<TagDTO> tagDTOList);

    /**
     * 删除流水线标签
     *
     * @param uuid
     * @return
     */
    @DeleteMapping(value = "/{uuid}", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> deleteTag(@PathVariable("uuid") String uuid);

    /**
     * 查询流水线标签
     *
     * @param uuid
     * @return
     */
    @GetMapping(value = "/{uuid}", produces = "application/json;charset=utf-8")
    ApiResult<TagDTO> queryTag(@PathVariable("uuid") String uuid);

    /**
     * 流水线标签变更
     * @param query
     * @return
     */
    @PostMapping(value = "/modifyPipelineTags", produces = "application/json;charset=utf-8")
    Boolean modifyPipelineTags(@RequestBody @Valid PipelineTagQuery query);
}
